package ru.gelin.android.keyboard;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;

/**
 *  Set of methods to hold main application settings.
 */
public class MainPreferences {

    static final String ON_DOCK_LISTEN = "on_dock_listen";
    static final boolean ON_DOCK_LISTEN_DEFAULT = true;

    static final String SHOW_NOTIFICATION = "show_notification";
    static final boolean SHOW_NOTIFICATION_DEFAULT = false;

    SharedPreferences prefererences;

    public MainPreferences(Context context) {
        this.prefererences = PreferenceManager.getDefaultSharedPreferences(context);
    }

    public boolean isOnDockListen() {
        return this.prefererences.getBoolean(ON_DOCK_LISTEN, ON_DOCK_LISTEN_DEFAULT);
    }

    public void setOnDockListen(boolean listen) {
        Log.i(Tag.TAG, ON_DOCK_LISTEN + " = " + listen);
        this.prefererences.edit().putBoolean(ON_DOCK_LISTEN, listen).commit();
    }

    public boolean isShowNotification() {
        return this.prefererences.getBoolean(SHOW_NOTIFICATION, SHOW_NOTIFICATION_DEFAULT);
    }

    public void setShowNotification(boolean show) {
        Log.i(Tag.TAG, SHOW_NOTIFICATION + " = " + show);
        this.prefererences.edit().putBoolean(SHOW_NOTIFICATION, show).commit();
    }

}
